import { constantRoutes } from '@/router'

const state = {
  routes: constantRoutes,
  showAccountManage: false
}

const mutations = {
  TOGGLE_ACCOUNT_MANAGE: (state, show) => {
    state.showAccountManage = show
    // 找到账户管理路由并修改其hidden属性
    const accountManageRoute = state.routes.find(route => route.path === '/Account-manage')
    if (accountManageRoute) {
      accountManageRoute.hidden = !show
    }
  }
}

const actions = {
  toggleAccountManage({ commit }, show) {
    commit('TOGGLE_ACCOUNT_MANAGE', show)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
} 